import type { ElementStyleConfig, StyleConfig } from './style_types'
import { EVENT_EMITTER_NAMES } from '../../../types/constants'
import { EventEmitter } from '../../event_emitter'
import { MarkElement } from '../../mark_element'

/**
 * 【基础模块类】
 * 提供存储管理等基础功能
 */
export abstract class StyleModule {
  protected readonly CONTAINER_STYLE: ElementStyleConfig[] = []
  protected readonly GLOBAL_STYLE: string = ''
  protected eventEmitter: EventEmitter = EventEmitter.getInstance()
  protected markElement: MarkElement = MarkElement.getInstance()

  getStyles(): StyleConfig {
    return {
      config: this.CONTAINER_STYLE,
      styles: this.GLOBAL_STYLE,
    }
  }

  /**
   * 隐藏元素
   */
  hideElements(): void {
    this.eventEmitter.emit(EVENT_EMITTER_NAMES.hideElement)
  }
}
